package com.zzq.controller;

import com.aliyuncs.exceptions.ClientException;
import com.zzq.domain.dto.SmileFeeDTO;
import com.zzq.result.SmileResult;
import com.zzq.domain.dto.SmileShootAddressDTO;
import com.zzq.domain.entity.SmileShootAddressApply;
import com.zzq.domain.search.ShootAddressSearchParamet;
import com.zzq.service.ShootAddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@Api(value = "摄影师地址控制接口",tags = {"摄影师地址控制接口"})
@RequestMapping("/photographer/shoot/address")
public class ShootAddressController {


    @Autowired
    ShootAddressService shootAddressService;

    @PostMapping("/list")
    @ApiOperation("获取摄影地址列表")
    public SmileResult list(@RequestBody ShootAddressSearchParamet searchParamet) {
        return shootAddressService.list(searchParamet);
    }

    @PostMapping("/add")
    @ApiOperation("添加拍摄地址")
    public SmileResult add(@RequestBody SmileShootAddressDTO shootAddress) {
        return shootAddressService.add(shootAddress);
    }
    @PostMapping("/fee/upd")
    @ApiOperation("更新拍摄费用")
    public SmileResult feeUpd(@RequestBody SmileFeeDTO smileFeeDTO) {
        return shootAddressService.feeUpd(smileFeeDTO);
    }


    @PostMapping("/photo/add")
    @ApiOperation("添加地址封面")
    public SmileResult addPhoto(MultipartFile file, @RequestParam("shootAddressId") Long shootAddressId) throws IOException, ClientException {
        return shootAddressService.addPhoto(shootAddressId, file);
    }
    @PostMapping("/sample/add")
    @ApiOperation("添加样片")
    public SmileResult addAddressSample( @RequestParam("shootAddressId")Long shootAddressId,MultipartFile file) throws IOException, ClientException{
        return shootAddressService.addAddressSample(shootAddressId, file);
    }
    @GetMapping("/sample/del")
    @ApiOperation("删除样片")
    public SmileResult addAddressSample( @RequestParam("shootAddressSampleId")Long shootAddressSampleId) {
        return  shootAddressService.delAddressSample(shootAddressSampleId);
    }

    /**
     * 申请摄影地点接口
     *
     * @param addressApply
     * @return
     */
    @PostMapping("/getApply")
    @ApiOperation("获取申请摄影地点")
    public SmileResult getApply(@RequestBody SmileShootAddressApply addressApply) {
        return shootAddressService.getApply(addressApply);
    }

    @PostMapping("/addApply")
    @ApiOperation("提交申请摄影地点")
    public SmileResult addApply(@RequestBody SmileShootAddressApply addressApply) {
        return shootAddressService.addApply(addressApply);
    }



    /**
     * 获取二维码接口
     *
     * @param searchParamet
     * @return
     */

    @PostMapping("/qRcode")
    @ApiOperation("获取二维码接口")
    public SmileResult getQRcode(@RequestBody ShootAddressSearchParamet searchParamet) throws Exception {
        return shootAddressService.getQRCode(searchParamet);
    }


}
